package com.iknow.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask.Status;
import android.os.Bundle;
import android.os.IBinder;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewFlipper;
import com.iknow.IKnow;
import com.iknow.IKnowApiV4;
import com.iknow.app.IKnowSystemConfig;
import com.iknow.data.QingBo;
import com.iknow.db.IKnowDataBase;
import com.iknow.http.HttpException;
import com.iknow.http.parser.HtmlParser;
import com.iknow.share.ShareHandler;
import com.iknow.share.SinaWeibo;
import com.iknow.task.CommonTask.ProductFavoriteTask;
import com.iknow.task.CommonTask.QingboOperateTask;
import com.iknow.task.CommonTask.QingboTask;
import com.iknow.task.GenericTask;
import com.iknow.task.TaskAdapter;
import com.iknow.task.TaskListener;
import com.iknow.task.TaskParams;
import com.iknow.task.TaskResult;
import com.iknow.ui.model.FavoriteQingboAdapter;
import com.iknow.ui.model.IKPageAdapter;
import com.iknow.ui.model.IKPageAdapter.OnFireOnAudioEvent;
import com.iknow.util.Loger;
import com.iknow.util.StringUtil;
import com.iknow.util.SystemUtil;
import com.iknow.view.widget.MyListView;
import com.iknow.view.widget.SelectScreenManager;
import com.iknow.view.widget.media.AudioView;
import com.iknow.view.widget.media.IKAudioInfo;
import com.iknow.xml.IKValuePageData.IKValuePageData_Item;
import com.iknow.xmpp.service.Friend;
import com.iknow.xmpp.service.aidl.IXmppFacade;
import com.iknow.xmpp.service.aidl.IXmppFacade.Stub;
import com.mobclick.android.MobclickAgent;
import com.weibo.net.ShareActivity;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.htmlparser.util.ParserException;

public class PageActivity extends Activity
{
  private static final Intent SERVICE_INTENT = new Intent();
  private View.OnClickListener BackButtonClickListener;
  private View.OnClickListener ChildImageButtonListener;
  private View.OnClickListener DeleteQingboClickListener;
  private View.OnClickListener FavButtonClickListener;
  private View.OnClickListener FeedBackButtonClickListener;
  private View.OnClickListener OtherContentButtonClickListener;
  private View.OnClickListener ShareButtonClickListener;
  private final String TAG = "PageActivity";
  private View.OnClickListener UserButtonClickListener;
  private View.OnClickListener UserInfoButtonClickListener;
  public PopupWindow aPopupWindow;
  private View.OnClickListener aboutButtonClickListener;
  private MenuItem.OnMenuItemClickListener fontClickListener;
  public RelativeLayout fontSetView;
  protected TextView font_progressShow;
  private boolean hasGet;
  private Button mAbout;
  private IKPageAdapter mAdapter;
  private IKAudioInfo mAudioInfo;
  private AudioView mAudioView;
  private Button mBackButton;
  private boolean mBinded;
  private Button mCommentButton;
  private Context mContext;
  private Button mDeleteButton;
  private Button mFavButton;
  private CommonTask.ProductFavoriteTask mFavoriteTask;
  private FireOnAudioEvent mFireOnAudioEvent;
  protected TaskListener mGetListener;
  private RelativeLayout mHeaderView;
  private HtmlParser mHtmlParser;
  private boolean mIsFavQingbo;
  protected LayoutInflater mLayoutInflater;
  private MyListView mListView;
  private TelephonyManager mPhoneManager;
  public PopupWindow mPopupWindow;
  private ProgressDialog mProgressDialog;
  private QingBo mQingbo;
  private CommonTask.QingboOperateTask mQingboOperateTask;
  protected SeekBar mSeekBar_font;
  private SelectScreenManager mSelectScreenManager;
  private Button mShareButton;
  private ShareHandler mShareHandler;
  private ServiceConnection mSvrConn;
  private GetDataTask mTask;
  protected TaskListener mTaskListener;
  private TextView mTitleText;
  private Button mUserButton;
  private BindWeiboTask mWeiboTask;
  private IXmppFacade mXmppFacade;
  private boolean mbReadLocal;
  public LinearLayout pageBottomView;
  protected CommonTask.QingboTask qingBoTask;
  private ImageButton switch_bn_auto;
  private MenuItem.OnMenuItemClickListener translateClickListener;
  public LinearLayout translateSetView;

  static
  {
    SERVICE_INTENT.setComponent(new ComponentName("com.iknow", "com.iknow.xmpp.service.IKnowXmppService"));
  }

  public PageActivity()
  {
    this.mSvrConn = new XmppServiceConnection(this, null);
    this.mAdapter = null;
    this.mFireOnAudioEvent = new FireOnAudioEvent(this, null);
    this.mbReadLocal = false;
    this.pageBottomView = null;
    this.mPopupWindow = null;
    this.aPopupWindow = null;
    this.fontSetView = null;
    this.translateSetView = null;
    this.mSeekBar_font = null;
    this.switch_bn_auto = null;
    this.font_progressShow = null;
    this.qingBoTask = null;
    this.mLayoutInflater = null;
    this.ChildImageButtonListener = new View.OnClickListener(this)
    {
      private boolean isOpen = true;

      public void onClick()
      {
        switch (paramView.getId())
        {
        default:
        case 2131296507:
        }
        while (true)
        {
          while (true)
          {
            return;
            if (!(this.isOpen))
              break;
            IKnow.mSystemConfig.setBoolean("switch_bn_auto", true);
            PageActivity.access$0(this.this$0).setImageResource(2130837768);
            this.isOpen = false;
          }
          IKnow.mSystemConfig.setBoolean("switch_bn_auto", false);
          PageActivity.access$0(this.this$0).setImageResource(2130837767);
          this.isOpen = true;
        }
      }
    };
    this.ShareButtonClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
        PageActivity.access$1(this.this$0);
      }
    };
    this.DeleteQingboClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
        AlertDialog.Builder localBuilder = new AlertDialog.Builder(this.this$0);
        localBuilder.setTitle("提示");
        localBuilder.setMessage("确认删除文章？");
        localBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener(this)
        {
          public void onClick(, int paramInt)
          {
            paramDialogInterface.cancel();
          }
        });
        localBuilder.setPositiveButton("删除", new DialogInterface.OnClickListener(this)
        {
          public void onClick(, int paramInt)
          {
            if ((PageActivity.access$2(PageActivity.3.access$0(this.this$1)) != null) && (PageActivity.access$2(PageActivity.3.access$0(this.this$1)).getStatus() == AsyncTask.Status.RUNNING));
            while (true)
            {
              return;
              PageActivity.access$3(PageActivity.3.access$0(this.this$1), new CommonTask.QingboOperateTask());
              TaskParams localTaskParams = new TaskParams();
              localTaskParams.put("code", Integer.valueOf(CommonTask.QingboOperateTask.ACTION_DELETE));
              localTaskParams.put("id", PageActivity.access$4(PageActivity.3.access$0(this.this$1)).getID());
              PageActivity.access$2(PageActivity.3.access$0(this.this$1)).setListener(PageActivity.3.access$0(this.this$1).mTaskListener);
              CommonTask.QingboOperateTask localQingboOperateTask = PageActivity.access$2(PageActivity.3.access$0(this.this$1));
              TaskParams[] arrayOfTaskParams = new TaskParams[1];
              arrayOfTaskParams[0] = localTaskParams;
              localQingboOperateTask.execute(arrayOfTaskParams);
            }
          }
        });
        localBuilder.create().show();
      }
    };
    this.UserButtonClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
        if (IKnow.mIKnowDataBase.getUser() == null)
        {
          Intent localIntent1 = new Intent(PageActivity.access$5(this.this$0), LoginActivity.class);
          PageActivity.access$5(this.this$0).startActivity(localIntent1);
          return;
        }
        String str = PageActivity.access$4(this.this$0).getAuthorID() + "@" + "imiknow.com";
        Friend localFriend = IKnow.mIKnowDataBase.getFriendInfo(str);
        Intent localIntent2 = new Intent(PageActivity.access$5(this.this$0), FriendActivity.class);
        if (localFriend != null)
          localIntent2.putExtra("friend", localFriend);
        while (true)
        {
          while (true)
            PageActivity.access$5(this.this$0).startActivity(localIntent2);
          localIntent2.putExtra("friend", new Friend(str, PageActivity.access$4(this.this$0).getAuthorName(), PageActivity.access$4(this.this$0).getAuthorAvatar()));
        }
      }
    };
    this.FeedBackButtonClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
        Intent localIntent = new Intent(this.this$0, CommentActivity.class);
        localIntent.putExtra("qingbo", PageActivity.access$4(this.this$0));
        this.this$0.startActivity(localIntent);
      }
    };
    this.FavButtonClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
        if (!(PageActivity.access$6(this.this$0)))
          if (IKnow.mIKnowDataBase.addFavoriteQingbo(PageActivity.access$4(this.this$0)))
          {
            Drawable localDrawable2 = this.this$0.getResources().getDrawable(2130837730);
            PageActivity.access$7(this.this$0).setCompoundDrawablesWithIntrinsicBounds(null, localDrawable2, null, null);
            PageActivity.access$7(this.this$0).setCompoundDrawables(null, localDrawable2, null, null);
            PageActivity.access$8(this.this$0, true);
            this.this$0.startSycn(1);
            PageActivity.access$7(this.this$0).setText("已收藏");
          }
        while (true)
        {
          return;
          IKnow.mIKnowDataBase.removeFavoriteQingbo(PageActivity.access$4(this.this$0));
          Drawable localDrawable1 = this.this$0.getResources().getDrawable(2130837729);
          PageActivity.access$7(this.this$0).setCompoundDrawablesWithIntrinsicBounds(null, localDrawable1, null, null);
          PageActivity.access$7(this.this$0).setCompoundDrawables(null, localDrawable1, null, null);
          PageActivity.access$8(this.this$0, false);
          this.this$0.startSycn(2);
          PageActivity.access$7(this.this$0).setText("收藏");
        }
      }
    };
    this.aboutButtonClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
        if (!(IKnow.IsNetAviable()))
          Toast.makeText(PageActivity.access$5(this.this$0), this.this$0.getString(2131361878), 0).show();
        label129: 
        do
          while (true)
          {
            while (true)
            {
              return;
              if ((this.this$0.mPopupWindow != null) && (this.this$0.mPopupWindow.isShowing()))
                this.this$0.mPopupWindow.dismiss();
              if (!(PageActivity.access$9(this.this$0)))
                break label129;
              if ((this.this$0.aPopupWindow == null) || (!(this.this$0.aPopupWindow.isShowing())))
                break;
              this.this$0.aPopupWindow.dismiss();
            }
            this.this$0.aPopupWindow.showAsDropDown(PageActivity.access$10(this.this$0));
          }
        while (((this.this$0.qingBoTask != null) && (this.this$0.qingBoTask.getStatus() == AsyncTask.Status.RUNNING)) || (PageActivity.access$9(this.this$0)));
        MobclickAgent.onEvent(this.this$0, "related_article_click", PageActivity.access$4(this.this$0).getTitle());
        String str1 = PageActivity.access$4(this.this$0).getTags();
        int i = str1.indexOf(",");
        String str2 = str1.substring(i + 1, str1.length());
        this.this$0.qingBoTask = new CommonTask.QingboTask();
        this.this$0.qingBoTask.setListener(this.this$0.mGetListener);
        TaskParams localTaskParams = new TaskParams();
        if (!(StringUtil.isEmpty(str2)))
          localTaskParams.put("keyword", str2);
        while (true)
        {
          while (true)
          {
            localTaskParams.put("offset", Integer.valueOf(0));
            localTaskParams.put("length", Integer.valueOf(20));
            CommonTask.QingboTask localQingboTask = this.this$0.qingBoTask;
            TaskParams[] arrayOfTaskParams = new TaskParams[1];
            arrayOfTaskParams[0] = localTaskParams;
            localQingboTask.execute(arrayOfTaskParams);
            PageActivity.access$11(this.this$0, true);
          }
          localTaskParams.put("keyword", str1.substring(0, i));
        }
      }
    };
    this.mGetListener = new TaskAdapter(this)
    {
      private FavoriteQingboAdapter adapter;
      private MyListView listView = null;
      private ViewFlipper mViewFlipper;
      private List<QingBo> qingboList;

      public String getName()
      {
        return "aboutQingBo";
      }

      public void onPostExecute(, TaskResult paramTaskResult)
      {
        super.onPostExecute(paramGenericTask, paramTaskResult);
        if ((this.qingboList != null) && (!(this.qingboList.isEmpty())))
        {
          this.adapter.resetTextColor(-1);
          this.listView.setAdapter(this.adapter);
          this.adapter.notifyDataSetChanged();
          this.mViewFlipper.addView(this.listView);
          this.this$0.aPopupWindow.showAsDropDown(PageActivity.access$10(this.this$0));
          this.mViewFlipper.startFlipping();
        }
        while (true)
        {
          PageActivity.access$13(this.this$0).dismiss();
          return;
          Toast.makeText(PageActivity.access$5(this.this$0), "没有找到相关文章", 0).show();
        }
      }

      public void onPreExecute()
      {
        PageActivity.access$12(this.this$0, ProgressDialog.show(PageActivity.access$5(this.this$0), "请稍等", "正在搜索相关文章...", false, true));
        this.listView = new MyListView(PageActivity.access$5(this.this$0), null);
        this.adapter = new FavoriteQingboAdapter(PageActivity.access$5(this.this$0), this.this$0.mLayoutInflater);
        this.mViewFlipper = new ViewFlipper(this.this$0);
        this.listView.setCacheColorHint(0);
        this.listView.setScrollingCacheEnabled(false);
        this.listView.setPadding(0, 10, 0, 55);
        this.listView.setBackgroundColor(2131165192);
        this.mViewFlipper.setInAnimation(AnimationUtils.loadAnimation(this.this$0, 2130968576));
        this.mViewFlipper.setOutAnimation(AnimationUtils.loadAnimation(this.this$0, 2130968577));
        this.mViewFlipper.setFlipInterval(60000);
        this.this$0.aPopupWindow = new PopupWindow(this.mViewFlipper, -1, SystemUtil.getDisplayHeight());
        this.this$0.aPopupWindow.setBackgroundDrawable(new BitmapDrawable());
        this.this$0.aPopupWindow.setFocusable(true);
        this.this$0.aPopupWindow.update();
        this.listView.setOnItemClickListener(new AdapterView.OnItemClickListener(this)
        {
          public void onItemClick(, View paramView, int paramInt, long paramLong)
          {
            QingBo localQingBo = PageActivity.8.access$0(this.this$1).getItem(paramInt);
            if (localQingBo == null);
            while (true)
            {
              return;
              Intent localIntent = new Intent(PageActivity.access$5(PageActivity.8.access$1(this.this$1)), PageActivity.class);
              localIntent.putExtra("item", localQingBo);
              PageActivity.8.access$1(this.this$1).startActivity(localIntent);
              PageActivity.8.access$1(this.this$1).aPopupWindow.dismiss();
              PageActivity.access$11(PageActivity.8.access$1(this.this$1), false);
            }
          }
        });
      }

      public void onProgressUpdate(, Object paramObject)
      {
        this.qingboList = ((List)paramObject);
        this.adapter.addQingboAtFoot(this.qingboList);
      }
    };
    this.BackButtonClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
        if (PageActivity.access$14(this.this$0) != null)
        {
          if (PageActivity.access$15(this.this$0) != null)
          {
            PageActivity.access$15(this.this$0).stopPlay();
            PageActivity.access$15(this.this$0).stopService();
            PageActivity.access$16(this.this$0, null);
          }
          PageActivity.access$17(this.this$0, null);
        }
        this.this$0.finish();
      }
    };
    this.UserInfoButtonClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
      }
    };
    this.OtherContentButtonClickListener = new View.OnClickListener(this)
    {
      public void onClick()
      {
      }
    };
    this.mTaskListener = new TaskAdapter(this)
    {
      public String getName()
      {
        return "GetDataTask";
      }

      public void onCancelled()
      {
      }

      public void onPostExecute(, TaskResult paramTaskResult)
      {
        if (PageActivity.access$18(this.this$0) == null);
        while (true)
        {
          while (true)
          {
            label276: label319: 
            do
              while (true)
              {
                while (true)
                {
                  while (true)
                  {
                    do
                    {
                      return;
                      if (PageActivity.access$13(this.this$0) != null)
                      {
                        PageActivity.access$13(this.this$0).dismiss();
                        PageActivity.access$12(this.this$0, null);
                      }
                      if (paramGenericTask instanceof CommonTask.ProductFavoriteTask)
                      {
                        if (paramTaskResult == TaskResult.OK)
                          Toast.makeText(PageActivity.access$5(this.this$0), "已同步至服务器", 0).show();
                        while (true)
                        {
                          List localList;
                          while (true)
                          {
                            while (true)
                            {
                              while (true)
                              {
                                if (MyFavoriteActivity.mfa == null);
                                MyFavoriteActivity.mfa.refresh();
                              }
                              localList = PageActivity.access$19(this.this$0).getQBList();
                              switch (PageActivity.access$19(this.this$0).getActionCode())
                              {
                              default:
                                Toast.makeText(PageActivity.access$5(this.this$0), PageActivity.access$19(this.this$0).getErrorMsg(), 0).show();
                              case 1:
                              case 2:
                              }
                            }
                            IKnow.mIKnowDataBase.addFavoriteQingbo((QingBo)localList.get(0));
                            Toast.makeText(PageActivity.access$5(this.this$0), "已收藏", 0).show();
                          }
                          IKnow.mIKnowDataBase.removeFavoriteQingbo((QingBo)localList.get(0));
                          Toast.makeText(PageActivity.access$5(this.this$0), "已删除", 0).show();
                        }
                      }
                      if (!(paramGenericTask instanceof PageActivity.GetDataTask))
                        break label276;
                    }
                    while (paramTaskResult == TaskResult.OK);
                    Toast.makeText(PageActivity.access$5(this.this$0), PageActivity.access$20(this.this$0).getMsg(), 0).show();
                    this.this$0.setContentView(2130903063);
                  }
                  if (!(paramGenericTask instanceof PageActivity.BindWeiboTask))
                    break label319;
                  if (paramTaskResult != TaskResult.OK)
                    break;
                  PageActivity.access$21(this.this$0);
                }
                Toast.makeText(PageActivity.access$5(this.this$0), "网络超时，请稍后再试", 0).show();
              }
            while (!(paramGenericTask instanceof CommonTask.QingboOperateTask));
            if (paramTaskResult == TaskResult.OK)
              break;
            Toast.makeText(PageActivity.access$5(this.this$0), "网络超时，请稍后再试", 0).show();
          }
          Toast.makeText(PageActivity.access$5(this.this$0), "操作成功", 0).show();
        }
      }

      public void onPreExecute()
      {
        if ((paramGenericTask instanceof PageActivity.BindWeiboTask) || (paramGenericTask instanceof CommonTask.QingboOperateTask))
        {
          PageActivity.access$12(this.this$0, new ProgressDialog(this.this$0));
          PageActivity.access$13(this.this$0).setMessage("请稍后");
          PageActivity.access$13(this.this$0).setCancelable(true);
          PageActivity.access$13(this.this$0).show();
        }
      }

      public void onProgressUpdate(, Object paramObject)
      {
        if (PageActivity.access$18(this.this$0) == null);
        while (true)
        {
          return;
          String str = (String)paramObject;
          PageActivity.access$22(this.this$0, str);
        }
      }
    };
    this.fontClickListener = new MenuItem.OnMenuItemClickListener(this)
    {
      public boolean onMenuItemClick()
      {
        int i;
        if (PageActivity.access$23(this.this$0) == null)
          i = 1;
        while (true)
        {
          return i;
          if ((this.this$0.mPopupWindow != null) && (this.this$0.mPopupWindow.isShowing()))
            this.this$0.mPopupWindow.dismiss();
          this.this$0.mPopupWindow = new PopupWindow(this.this$0.fontSetView, -1, -2);
          PageActivity.access$23(this.this$0).setMenuPopupWindow(this.this$0.mPopupWindow);
          this.this$0.mPopupWindow.setAnimationStyle(16973826);
          this.this$0.mPopupWindow.showAtLocation(PageActivity.access$24(this.this$0), 17, 0, 0);
          i = 1;
        }
      }
    };
    this.translateClickListener = new MenuItem.OnMenuItemClickListener(this)
    {
      public boolean onMenuItemClick()
      {
        int i;
        if (PageActivity.access$23(this.this$0) == null)
          i = 1;
        while (true)
        {
          return i;
          if ((this.this$0.mPopupWindow != null) && (this.this$0.mPopupWindow.isShowing()))
            this.this$0.mPopupWindow.dismiss();
          this.this$0.mPopupWindow = new PopupWindow(this.this$0.translateSetView, -1, -2);
          PageActivity.access$23(this.this$0).setMenuPopupWindow(this.this$0.mPopupWindow);
          this.this$0.mPopupWindow.setAnimationStyle(16973826);
          this.this$0.mPopupWindow.showAtLocation(PageActivity.access$24(this.this$0), 17, 0, 0);
          i = 1;
        }
      }
    };
  }

  private void getServerData()
  {
    if ((this.mTask != null) && (this.mTask.getStatus() == AsyncTask.Status.RUNNING));
    while (true)
    {
      return;
      this.mTask = new GetDataTask(this, null);
      this.mTask.setListener(this.mTaskListener);
      this.mTask.execute(new TaskParams[0]);
    }
  }

  private void initView()
  {
    setContentView(2130903107);
    this.mListView = ((MyListView)findViewById(2131296487));
    this.mListView.setBackgroundColor(IKnow.mSystemConfig.getBook_BackGround());
    this.mLayoutInflater = getLayoutInflater();
    this.pageBottomView = ((LinearLayout)this.mLayoutInflater.inflate(2130903106, null));
    this.mHeaderView = ((RelativeLayout)this.mLayoutInflater.inflate(2130903108, null));
    this.fontSetView = ((RelativeLayout)this.mLayoutInflater.inflate(2130903111, null));
    this.translateSetView = ((LinearLayout)this.mLayoutInflater.inflate(2130903113, null));
    this.mSeekBar_font = ((SeekBar)this.fontSetView.findViewById(2131296501));
    this.font_progressShow = ((TextView)this.fontSetView.findViewById(2131296500));
    this.switch_bn_auto = ((ImageButton)this.translateSetView.findViewById(2131296507));
    this.switch_bn_auto.setBackgroundColor(0);
    if (IKnow.mSystemConfig.getBoolean("switch_bn_auto"))
    {
      this.switch_bn_auto.setImageResource(2130837768);
      this.mTitleText = ((TextView)this.mHeaderView.findViewById(2131296490));
      this.mTitleText.setText(this.mQingbo.getTitle());
      this.mAdapter.setTitle(this.mQingbo.getTitle());
      this.mListView.addHeaderView(this.mHeaderView);
      this.mBackButton = ((Button)findViewById(2131296342));
      this.mBackButton.setOnClickListener(this.BackButtonClickListener);
      this.mCommentButton = ((Button)findViewById(2131296484));
      this.mCommentButton.setOnClickListener(this.FeedBackButtonClickListener);
      this.mUserButton = ((Button)findViewById(2131296344));
      this.mUserButton.setBackgroundResource(2130837714);
      this.mUserButton.setOnClickListener(this.UserButtonClickListener);
      if (!(this.mQingbo.getCommentCount().equalsIgnoreCase("0")))
        break label603;
      this.mCommentButton.setText("暂无评论");
      this.mFavButton = ((Button)findViewById(2131296482));
      if (!(IKnow.mIKnowDataBase.isFavoriteQingbo(this.mQingbo)))
        break label637;
      this.mIsFavQingbo = true;
      Drawable localDrawable2 = getResources().getDrawable(2130837730);
      this.mFavButton.setCompoundDrawablesWithIntrinsicBounds(null, localDrawable2, null, null);
      this.mFavButton.setCompoundDrawables(null, localDrawable2, null, null);
      this.mFavButton.setText("已收藏");
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          this.mFavButton.setOnClickListener(this.FavButtonClickListener);
          this.mShareButton = ((Button)findViewById(2131296406));
          this.mShareButton.setOnClickListener(this.ShareButtonClickListener);
          this.mDeleteButton = ((Button)findViewById(2131296488));
          this.mAudioView = ((AudioView)findViewById(2131296485));
          this.mSelectScreenManager = new SelectScreenManager(this, findViewById(2131296486), getLayoutInflater());
          this.mAdapter.setSelectScreenManager(this.mSelectScreenManager);
          this.mAbout = ((Button)findViewById(2131296483));
          this.mAbout.setOnClickListener(this.aboutButtonClickListener);
          this.switch_bn_auto.setOnClickListener(this.ChildImageButtonListener);
          this.mSeekBar_font.setOnSeekBarChangeListener(new SeekBarChangeListener(this));
          return;
          this.switch_bn_auto.setImageResource(2130837767);
        }
        label603: Object[] arrayOfObject = new Object[1];
        arrayOfObject[0] = this.mQingbo.getCommentCount();
        String str = String.format("%s条评论", arrayOfObject);
        this.mCommentButton.setText(str);
      }
      label637: Drawable localDrawable1 = getResources().getDrawable(2130837729);
      this.mFavButton.setCompoundDrawablesWithIntrinsicBounds(null, localDrawable1, null, null);
      this.mFavButton.setCompoundDrawables(null, localDrawable1, null, null);
      this.mFavButton.setText("收藏");
    }
  }

  private boolean isWeiboTokenConfiged()
  {
    boolean bool = this.mShareHandler.isAuthenticated();
    if ((bool) || ((this.mWeiboTask != null) && (this.mWeiboTask.getStatus() == AsyncTask.Status.RUNNING)));
    while (true)
    {
      return bool;
      this.mWeiboTask = new BindWeiboTask(this, null);
      this.mWeiboTask.setListener(this.mTaskListener);
      this.mWeiboTask.execute(new TaskParams[0]);
    }
  }

  private void loadData(String paramString)
  {
    initView();
    this.mHtmlParser = new HtmlParser(this.mAdapter);
    try
    {
      this.mHtmlParser.parseHtml(paramString);
      this.mListView.setAdapter(this.mAdapter);
      this.mAdapter.notifyDataSetChanged();
      MobclickAgent.onEvent(this, "read_page", this.mQingbo.getTitle());
      return;
    }
    catch (ParserException localParserException)
    {
      localParserException.printStackTrace();
    }
  }

  private void onBindShareComplete()
  {
    String str = this.mWeiboTask.getUrl();
    Intent localIntent = new Intent(this, AuthorizationWeiboActivity.class);
    localIntent.setData(Uri.parse(str));
    if (this.mShareHandler instanceof SinaWeibo)
      IKnow.mSystemConfig.setInt("share_type", 1);
    startActivity(localIntent);
  }

  private void readLocalData()
  {
    String str;
    try
    {
      str = IKnow.mApi.getQingBoLocal(this.mQingbo.getID());
      if (str != null)
      {
        loadData(str);
        this.mbReadLocal = true;
      }
      else
      {
        this.mbReadLocal = false;
      }
    }
    catch (HttpException localHttpException)
    {
      Loger.e("PageActivity", localHttpException.getMessage());
      localHttpException.printStackTrace();
    }
  }

  private void showShareDialog()
  {
    CharSequence[] arrayOfCharSequence = new CharSequence[2];
    arrayOfCharSequence[0] = "分享到新浪微博";
    arrayOfCharSequence[1] = "分享到其他";
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(this);
    localBuilder.setTitle("分享");
    localBuilder.setNegativeButton("取消", new DialogInterface.OnClickListener(this)
    {
      public void onClick(, int paramInt)
      {
        paramDialogInterface.cancel();
      }
    });
    localBuilder.setItems(arrayOfCharSequence, new DialogInterface.OnClickListener(this, arrayOfCharSequence)
    {
      public void onClick(, int paramInt)
      {
        String str = this.val$items[paramInt].toString();
        if (str.equalsIgnoreCase("分享到其他"))
        {
          Intent localIntent1 = new Intent("android.intent.action.SEND");
          localIntent1.setType("text/plain");
          localIntent1.putExtra("android.intent.extra.SUBJECT", "分享");
          Object[] arrayOfObject = new Object[2];
          arrayOfObject[0] = PageActivity.access$4(this.this$0).getSubject();
          arrayOfObject[1] = IKnow.mApi.getShareQingboUrl(PageActivity.access$4(this.this$0).getID());
          localIntent1.putExtra("android.intent.extra.TEXT", String.format("%s %s", arrayOfObject));
          this.this$0.startActivity(Intent.createChooser(localIntent1, this.this$0.getTitle()));
        }
        while (true)
        {
          int i;
          do
          {
            return;
            i = 0;
            if (str.equalsIgnoreCase("分享到新浪微博"))
            {
              PageActivity.access$29(this.this$0, new SinaWeibo());
              i = 1;
            }
            PageActivity.access$30(this.this$0);
          }
          while (!(PageActivity.access$31(this.this$0)));
          Intent localIntent2 = new Intent(this.this$0, ShareActivity.class);
          localIntent2.putExtra("type", i);
          this.this$0.startActivity(localIntent2);
        }
      }
    });
    localBuilder.create().show();
  }

  private void writeWeiboData()
  {
    Object[] arrayOfObject = new Object[3];
    arrayOfObject[0] = this.mQingbo.getTitle().trim();
    arrayOfObject[1] = this.mQingbo.getSubject().trim();
    arrayOfObject[2] = IKnow.mApi.getShareQingboUrl(this.mQingbo.getID());
    String str = String.format("%s:%s %s", arrayOfObject);
    IKnow.mSystemConfig.setString("weibo_content", str);
    if (!(StringUtil.isEmpty(this.mQingbo.getThumbnailUrl())))
      IKnow.mSystemConfig.setString("weibo_picture", this.mQingbo.getThumbnailUrl());
    while (true)
    {
      return;
      IKnow.mSystemConfig.setString("weibo_picture", "");
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    requestWindowFeature(1);
    super.onCreate(paramBundle);
    getWindow().setFlags(1024, 1024);
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131492866, paramMenu);
    MenuItem localMenuItem1 = paramMenu.getItem(0);
    localMenuItem1.setIcon(2130837617);
    localMenuItem1.setOnMenuItemClickListener(this.fontClickListener);
    MenuItem localMenuItem2 = paramMenu.getItem(1);
    localMenuItem2.setIcon(2130837619);
    localMenuItem2.setOnMenuItemClickListener(this.translateClickListener);
    return super.onCreateOptionsMenu(paramMenu);
  }

  protected void onDestroy()
  {
    if (this.mSelectScreenManager != null)
    {
      this.mSelectScreenManager.dismissWindow();
      this.mSelectScreenManager = null;
    }
    if (this.mAudioInfo != null)
    {
      if (this.mAudioView != null)
      {
        this.mAudioView.stopPlay();
        this.mAudioView.stopService();
        this.mAudioView = null;
      }
      this.mAudioInfo = null;
    }
    this.mAdapter.onDestroy();
    this.mAdapter.clearAllImage();
    this.mAdapter = null;
    this.mbReadLocal = false;
    if ((this.mTask != null) && (this.mTask.getStatus() == AsyncTask.Status.RUNNING))
      this.mTask.cancel(true);
    super.onDestroy();
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    boolean bool;
    if (paramInt == 4)
      if ((this.mPopupWindow != null) && (this.mPopupWindow.isShowing()))
      {
        this.mPopupWindow.dismiss();
        IKnow.mSystemConfig.saveBook_TextSize();
        bool = true;
      }
    while (true)
    {
      while (true)
      {
        return bool;
        if ((this.aPopupWindow == null) || (!(this.aPopupWindow.isShowing())))
          break;
        this.aPopupWindow.dismiss();
        bool = true;
      }
      if (this.mAudioInfo != null)
      {
        if (this.mAudioView != null)
        {
          this.mAudioView.stopPlay();
          this.mAudioView.stopService();
          this.mAudioView = null;
        }
        this.mAudioInfo = null;
      }
      bool = super.onKeyDown(paramInt, paramKeyEvent);
    }
  }

  protected void onNewIntent(Intent paramIntent)
  {
    super.onNewIntent(paramIntent);
    setIntent(paramIntent);
  }

  protected void onPause()
  {
    if (this.mBinded)
    {
      unbindService(this.mSvrConn);
      this.mBinded = false;
    }
    if ((this.mWeiboTask != null) && (this.mWeiboTask.getStatus() == AsyncTask.Status.RUNNING))
      this.mWeiboTask.cancel(true);
    MobclickAgent.onPause(this);
    super.onPause();
  }

  protected void onRestoreInstanceState(Bundle paramBundle)
  {
    super.onRestoreInstanceState(paramBundle);
  }

  protected void onResume()
  {
    MobclickAgent.onResume(this);
    MobclickAgent.setSessionContinueMillis(600000L);
    if (!(this.mBinded))
      this.mBinded = bindService(SERVICE_INTENT, this.mSvrConn, 1);
    QingBo localQingBo = (QingBo)getIntent().getParcelableExtra("item");
    if (this.mQingbo != null)
      if (!(this.mQingbo.getID().equalsIgnoreCase(localQingBo.getID())))
      {
        setContentView(2130903078);
        if (this.mAudioInfo != null)
        {
          if (this.mAudioView != null)
          {
            this.mAudioView.stopPlay();
            this.mAudioView.stopService();
            this.mAudioView = null;
          }
          this.mAudioInfo = null;
        }
        if (this.mSelectScreenManager != null)
        {
          this.mSelectScreenManager.dismissWindow();
          this.mSelectScreenManager = null;
        }
        this.mListView.removeHeaderView(this.mHeaderView);
        this.mAdapter.onDestroy();
        this.mAdapter = null;
        this.mQingbo = null;
        this.mQingbo = localQingBo;
        this.mAdapter = new IKPageAdapter(this, getLayoutInflater());
        this.mAdapter.setAudioEventListener(this.mFireOnAudioEvent);
        this.mContext = this;
        readLocalData();
        if (!(this.mbReadLocal))
          getServerData();
        super.onResume();
      }
    while (true)
    {
      while (true)
      {
        return;
        super.onResume();
      }
      setContentView(2130903078);
      this.mQingbo = localQingBo;
      this.mAdapter = new IKPageAdapter(this, getLayoutInflater());
      this.mAdapter.setAudioEventListener(this.mFireOnAudioEvent);
      this.mContext = this;
      readLocalData();
      if (!(this.mbReadLocal))
        getServerData();
      super.onResume();
    }
  }

  protected void onSaveInstanceState(Bundle paramBundle)
  {
    super.onSaveInstanceState(paramBundle);
  }

  public void startSycn(int paramInt)
  {
    if ((this.mFavoriteTask != null) && (this.mFavoriteTask.getStatus() == AsyncTask.Status.RUNNING));
    while (true)
    {
      return;
      this.mFavoriteTask = new CommonTask.ProductFavoriteTask(this.mContext);
      this.mFavoriteTask.setListener(this.mTaskListener);
      TaskParams localTaskParams = new TaskParams();
      ArrayList localArrayList = new ArrayList();
      localArrayList.add(this.mQingbo);
      this.mFavoriteTask.setQBList(localArrayList);
      localTaskParams.put("action", Integer.valueOf(paramInt));
      localTaskParams.put("xmpp", this.mXmppFacade);
      CommonTask.ProductFavoriteTask localProductFavoriteTask = this.mFavoriteTask;
      TaskParams[] arrayOfTaskParams = new TaskParams[1];
      arrayOfTaskParams[0] = localTaskParams;
      localProductFavoriteTask.execute(arrayOfTaskParams);
    }
  }

  private class BindWeiboTask extends GenericTask
  {
    private String mUrl;

    protected TaskResult _doInBackground()
    {
      TaskResult localTaskResult;
      this.mUrl = PageActivity.access$25(this.this$0).getAuthenticationUrl(this.this$0);
      if (this.mUrl != null)
        localTaskResult = TaskResult.OK;
      while (true)
      {
        return localTaskResult;
        localTaskResult = TaskResult.FAILED;
      }
    }

    public String getUrl()
    {
      return this.mUrl;
    }
  }

  private class FireOnAudioEvent
  implements IKPageAdapter.OnFireOnAudioEvent
  {
    public void onAudioEvent()
    {
      PageActivity.access$17(this.this$0, new IKAudioInfo());
      String str = (String)paramIKValuePageData_Item.data.get("src");
      PageActivity.access$14(this.this$0).setUrl(str);
      PageActivity.access$15(this.this$0).setAudioInfo(PageActivity.access$14(this.this$0));
      PageActivity.access$26(this.this$0, (TelephonyManager)this.this$0.getSystemService("phone"));
      PageActivity.access$27(this.this$0).listen(new PageActivity.PhoneListener(this.this$0, null), 32);
    }
  }

  private class GetDataTask extends GenericTask
  {
    private String msg = null;

    protected TaskResult _doInBackground()
    {
      TaskResult localTaskResult;
      String str;
      try
      {
        str = IKnow.mApi.getQingBo(PageActivity.access$4(this.this$0).getID());
        if (str != null)
        {
          Object[] arrayOfObject = new Object[1];
          arrayOfObject[0] = str;
          publishProgress(arrayOfObject);
        }
        localTaskResult = TaskResult.OK;
        return localTaskResult;
      }
      catch (HttpException localHttpException)
      {
        this.msg = localHttpException.getMessage();
        localTaskResult = TaskResult.FAILED;
      }
    }

    public String getMsg()
    {
      return this.msg;
    }
  }

  private class PhoneListener extends PhoneStateListener
  {
    int nStatus = 0;

    public void onCallStateChanged(, String paramString)
    {
      switch (paramInt)
      {
      default:
      case 1:
      case 0:
      case 2:
      }
      while (true)
      {
        while (true)
        {
          while (true)
          {
            super.onCallStateChanged(paramInt, paramString);
            return;
            if ((PageActivity.access$15(this.this$0) != null) && (1 != this.nStatus))
              PageActivity.access$15(this.this$0).pause();
            this.nStatus = 1;
          }
          if ((PageActivity.access$15(this.this$0) != null) && (this.nStatus != 0))
            PageActivity.access$15(this.this$0).startPlay();
          this.nStatus = 0;
        }
        if ((PageActivity.access$15(this.this$0) != null) && (1 != this.nStatus))
          PageActivity.access$15(this.this$0).startPlay();
        this.nStatus = 2;
      }
    }
  }

  public class SeekBarChangeListener
  implements SeekBar.OnSeekBarChangeListener
  {
    public int interval = 3;

    public SeekBarChangeListener()
    {
      paramPageActivity.mSeekBar_font.setProgress((IKnow.mSystemConfig.getBook_TextSize() - 10) * this.interval);
    }

    public void onProgressChanged(, int paramInt, boolean paramBoolean)
    {
      this.this$0.font_progressShow.setText(paramInt + "%");
      int i = 10 + Math.round(paramInt / this.interval);
      this.this$0.mSeekBar_font.setProgress(paramInt);
      IKnow.setTextSize(PageActivity.access$18(this.this$0), i);
    }

    public void onStartTrackingTouch()
    {
      this.this$0.font_progressShow.setVisibility(0);
    }

    public void onStopTrackingTouch()
    {
      this.this$0.font_progressShow.setVisibility(4);
    }
  }

  private class XmppServiceConnection
  implements ServiceConnection
  {
    public void onServiceConnected(, IBinder paramIBinder)
    {
      PageActivity.access$28(this.this$0, IXmppFacade.Stub.asInterface(paramIBinder));
    }

    public void onServiceDisconnected()
    {
      PageActivity.access$28(this.this$0, null);
    }
  }
}